//
//  ST_BTAlertViewController.swift
//  btvideo
//
//  Created by mac on 2020/1/21.
//  Copyright © 2020 JarvanZhang. All rights reserved.
//

import UIKit
import SnapKit
import SwiftyAttributes
import SwifterSwift
import SwiftyUserDefaults


//MARK: -
class ST_BTAlertViewController: UIViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        view.addSubview(root_view)
        root_view.snp.makeConstraints { (make) in
            make.width.equalTo(root_view_width)
            make.height.equalTo(root_view_height)
            make.centerX.equalToSuperview()
            make.centerY.equalToSuperview()
            //            .offset(-ScreenHeight/10)
        }
        
        root_view.addSubview(cover_image_view)
        cover_image_view.snp.makeConstraints { (make) in
            make.size.equalTo(cover_image_size)
            make.top.equalToSuperview().offset(30)
            make.centerX.equalToSuperview()
        }
        
        root_view.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (make) in
            make.top.equalTo(cover_image_view.snp.bottom).offset(20)
            make.centerX.equalToSuperview()
        }
        
        
        root_view.addSubview(content_label)
        content_label.snp.makeConstraints { (make) in
            make.top.equalTo(titleLabel.snp.bottom).offset(10)
            make.centerX.equalToSuperview()
        }
        
        
        
        root_view.addSubview(cancel_btn)
        cancel_btn.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview().offset(-39)
            make.width.equalTo(120)
            make.height.equalTo(36)
            make.left.equalToSuperview().offset(29)
        }
        
        
        root_view.addSubview(confirm_btn)
        confirm_btn.snp.makeConstraints { (make) in
            make.bottom.equalToSuperview().offset(-39)
            make.width.equalTo(120)
            make.height.equalTo(36)
            make.right.equalToSuperview().offset(-26)
        }
        
        //        支持  没有取消 按钮
        if cancel_btn_title.isEmpty{
            cancel_btn.isHidden = true
            confirm_btn.snp.remakeConstraints { (make) in
                make.bottom.equalToSuperview().offset(-39)
                make.width.equalTo(120)
                make.height.equalTo(36)
                make.centerX.equalToSuperview()
            }
        }else{
            cancel_btn.setTitleForAllStates(cancel_btn_title)
            cancel_btn.isHidden = false
        }
        
        
    }
    
    fileprivate func hidden_cancel_btn_with_layout(){
        
        
    }
    
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
    }
    
    @objc public convenience init(title:NSAttributedString,message:NSAttributedString,imageName:String,confirmText:String = "确定",cancelText:String = "重新选择") {
        
        self.init(nibName: nil, bundle: nil)
        
        titleLabel.attributedText = title
        content_label.attributedText = message
        
        if let img = UIImage.init(named: imageName){
            cover_image_view.image = img
        }else{
            cover_image_view.pin_setImage(from: imageName.url)
        }
        
        cancel_btn_title = cancelText
        
        confirm_btn.setTitleForAllStates(confirmText)
        
    }
    
    @objc public convenience init(title:NSAttributedString,message:NSAttributedString,imageURL:String,confirmText:String = "确定",cancelText:String = "重新选择") {
        
        self.init(nibName: nil, bundle: nil)
        
        titleLabel.attributedText = title
        content_label.attributedText = message
        
        cover_image_view.pin_setImage(from: imageURL.url, placeholderImage: ST_SwiftConst.shared.fetch_random_place_holder_image())
        
        cancel_btn_title = cancelText
        
        confirm_btn.setTitleForAllStates(confirmText)
        
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //    MARK:- Properties
    @objc var root_view_height = 250.cgFloat
    
    @objc var root_view_width = 310.cgFloat
    
    
    @objc var cover_image_size = CGSize.init(width: 50, height: 50)
    
    fileprivate lazy var root_view:UIView = {
        let control = UIView()
        control.backgroundColor = Color.white
        control.cornerRadius = 20
        control.borderColor = Color.init(hexString: "#979797")
        control.borderWidth = 1
        return control
    }()
    
    fileprivate lazy var cover_image_view:UIImageView = {
        let control = UIImageView()
        control.contentMode = UIView.ContentMode.scaleAspectFill
        return control
    }()
    
    fileprivate lazy var titleLabel:UILabel = {
        let control = UILabel.init()
        return control
    }()
    
    fileprivate lazy var content_label:UILabel = {
        let control = UILabel.init()
        control.numberOfLines = 0
        return control
    }()
    
    
    fileprivate lazy var confirm_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        control.backgroundColor = Color.init(hexString: "#FEC207")
        control.cornerRadius = 36/2.0
        control.setTitleForAllStates("知道了")
        control.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.semibold)
        control.setTitleColorForAllStates(UIColor.white)
        control.addTarget(self, action: #selector(confirm_handle), for: UIControl.Event.touchUpInside)
        return control
    }()
    
    fileprivate var cancel_btn_title = "重新选择"
    
    fileprivate lazy var cancel_btn:UIButton = {
        
        let control = UIButton.init(type: UIButton.ButtonType.custom)
        control.backgroundColor = Color.init(hexString: "#F2F4F7")
        control.cornerRadius = 36/2.0
        control.titleLabel?.font = UIFont.systemFont(ofSize: 15, weight: UIFont.Weight.regular)
        control.setTitleColorForAllStates(UIColor.init(hexString: "#61666F")!)
        control.addTarget(self, action: #selector(cancel_handle), for: UIControl.Event.touchUpInside)
        return control
    }()
    
    
    //    MARK: - Public
    var dismiss_after_action = true
    @objc var confirm_closure:(()->())?
    @objc var cancel_closure:(()->())?
    
}


extension ST_BTAlertViewController{
    
    @objc func confirm_handle(){
        
        if dismiss_after_action{
            self.dismiss(animated: false) {
                self.confirm_closure?()
            }
        }else{
            self.confirm_closure?()
        }
    }
    
    @objc func cancel_handle(){
        
        self.dismiss(animated: false) {
            self.cancel_closure?()
        }
    }
    
    
}






//MARK: - 竖直排列的 确定和取消
class BTVerticalAlertViewController: ST_BTAlertViewController {
    
    /**
     Button 高度 44
     */
    var widerButtonHeight = false
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        cancel_btn.backgroundColor = UIColor.clear
        
        //        支持  没有取消 按钮
        if cancel_btn_title.isEmpty{
            cancel_btn.isHidden = true
            confirm_btn.snp.remakeConstraints { (make) in
                make.bottom.equalToSuperview().offset(-30)
                make.width.equalTo(200)
                make.height.equalTo(44)
                make.centerX.equalToSuperview()
            }
        }else if widerButtonHeight{
            
            cancel_btn.snp.remakeConstraints { (make) in
                make.bottom.equalToSuperview().offset(-8)
                make.width.equalTo(200)
                make.height.equalTo(44)
                make.centerX.equalToSuperview()
            }
            
            
            confirm_btn.snp.remakeConstraints { (make) in
                make.bottom.equalTo(cancel_btn.snp.top)
                make.width.equalTo(200)
                make.height.equalTo(44)
                make.centerX.equalToSuperview()
            }
            
        }else{
            
            
            
            cancel_btn.snp.remakeConstraints { (make) in
                make.bottom.equalToSuperview().offset(-25)
                make.width.equalTo(140)
                make.height.equalTo(35)
                make.centerX.equalToSuperview()
            }
            
            
            confirm_btn.snp.remakeConstraints { (make) in
                make.bottom.equalTo(cancel_btn.snp.top).offset(-10)
                make.width.equalTo(140)
                make.height.equalTo(35)
                make.centerX.equalToSuperview()
            }
        }
        
        
        
    }
}


extension BTVerticalAlertViewController{
    
    
    
    /**
     亲密度调整Alert
     */
    static func createChangeIntimacyConfinedAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "请确认")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        
        let attrString1 = NSMutableAttributedString(string: "亲密度每天只能调整一次，确认调整吗?")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "确认", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     充值提示Alert
     */
    static func createRequireRechargeAlert(content:String = "")->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "甜心币不够了")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        var str = "你的甜心币余额不足了哦~立刻去补\n充一点就可以使用啦！"
        
        if content.count > 1{
            str = content
        }
        
        let attrString1 = NSMutableAttributedString(string: str)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "kValue不够了", confirmText: "获取更多", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     派对充值提示Alert
     */
    static func createPartyRequireRechargeAlert(content:String = "")->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "甜心币不够了")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        var str = "房主建房辛苦，为表诚意，加入派对\n余额至少需要5个甜心币"
        
        if content.count > 1{
            str = content
        }
        
        let attrString1 = NSMutableAttributedString(string: str)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "kValue不够了", confirmText: "获取更多", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        alert.confirm_closure = {
            
            ST_MaidWayManager.shared.source = .语音房
            
            ST_RechargeViewController.toast()
            
        }
        
        
        
        return alert
        
    }
    
    
    /**
     守护Alert
     */
    static func createGuardAlert(title:String,content:String)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: title)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: content)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "guard_top_icon", confirmText: "好的", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 340
        
        alert.root_view_width = 300
        
        
        return alert
        
    }
    
    
    
    
    /**
     赠送会员成功Alert
     */
    static func createGiveMemberAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "会员赠送成功")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "恭喜恭喜！对方已经成为伴心大会员了\n哟！多亏了慷慨大方的你呢！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "成为会员成功",confirmText: "好的", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     购买会员成功Alert
     */
    static func createPayMemberSuccessAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "会员购买成功")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "恭喜恭喜！现在你已经是伴心大会员了\n哟！快去体验专属你的会员特权吧！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "成为会员成功",confirmText: "好的", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    
    
    /**
     充值甜心币成功Alert
     */
    static func createRechargeSuccessAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "甜心币买成功")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "恭喜恭喜！你购买的甜心币已经到账了\n哦！请尽情买买买吧！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "kValue不够了",confirmText: "好的", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    /**
     对对碰没有特质Alert
     */
    static func createPpNoOwnPecAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "还没有特质哦")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "添加了你的特质之后，才可以使用特\n质对对碰功能，立刻去添加吧！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "添加特质", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    /**
     通话警告弹窗
     */
    static func engagementWarningAlert(title:String,content:String)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: title)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: content)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "好的", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 340
        
        alert.root_view_width = 300
        
        return alert
        
    }
    
    /**
     成为密友才能聊天Alert
     */
    static func createIntimacyForMediaTalkAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "成为密友才能解锁通话")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "达到亲密等级小幸运，成为密友就能\n解锁通话啦！聊天和送礼物都可\n以提供亲密度。")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "亲密度提示001", confirmText: "送礼物", cancelText: "继续聊天")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 372
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    /**
     关闭丘比特 提示Alert
     */
    static func createCloseCopidAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "关闭伴心丘比特")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "关闭后伴心的丘比特之箭\n就没法射中附近的TA了哦！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "close_copid_big_icon", confirmText: "保持开启", cancelText: "确认关闭")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    /**
     添加伴心客服 Alert
     */
    static func createTianKeFuTalkAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "提示")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "微信号已复制，请打开微信\n添加【伴心客服】微信")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "立即添加", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    static func createDetectFaceForTalkAlert(title:String,content:String,confirmStr:String,cancelStr:String,viewHeight:CGFloat = 352)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: title)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: content)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: confirmStr, cancelText: cancelStr)
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = viewHeight
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
        
    }
    
    /**
     认证之后在聊天Alert
     */
    static func createDetectFaceForTalkAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "TA要求你真人认证哦")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "对方开启了只允许认证通过用户与TA对\n话，认证之后就可以与TA聊天了哦")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "立即认证", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     开通会员之后在聊天Alert
     */
    static func createRequireMemberForTalkAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "TA要求你是会员哦")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "对方开启了只允许会员用户与TA对话\n成为会员之后就可以与TA聊天了哦")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "成为会员", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     开通会员之后在聊天Alert 人太多
     */
    static func createRequireMemberForTooMoreTalkAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "TA今天已经收到很多人的聊天了")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "为了保护用户收到过度打扰，请明天再来\n找她或者开通会员使用特权直接聊天")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "morePersonMember_icon", confirmText: "成为会员开启聊天", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     聊天添加特质Alert
     */
    static func createChatForPeculiarityAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "添加特质提升对方回复几率")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "添加3个及以上【我的特质】，对方\n回复你的几率至少会增加2倍哦！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "peculiarity_for_chat_icon", confirmText: "添加特质", cancelText: "继续聊天")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 90, height: 90)
        
        alert.root_view_height = 317
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    
    
    /**
     每次点击 伴心Tab 认证
     */
    
    
    static func createTipsForDetectedAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "完成真人认证获得优先配对")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
           attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
           
           let attrString1 = NSMutableAttributedString(string: "认证用户享有优先推荐与曝光，\n收到喜欢配对几率增加5倍！")
        
           let paragh = NSMutableParagraphStyle()
           paragh.alignment = .center
           paragh.lineSpacing = 3
           
           let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
           
           attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
           
           
           let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "everyTime_detect", confirmText: "去认证", cancelText: "稍后再说")

        alert.confirm_btn.backgroundColor = UIColor.init(hex: 0x42CEDA)
        
           alert.overCurrentContext = true
           
           alert.over_current_context_alpha = "0.4"

           alert.cover_image_size = CGSize.init(width: 202, height: 118)
        
           alert.root_view_height = 352
           
           alert.root_view_width = 300
        
           alert.widerButtonHeight = true
        
        
        alert.confirm_closure = {
            DetectFaceHandle()
        }
            return alert
        
    }
    
    
    static func presentVoiceSignTips(){
        
        let attrString = NSMutableAttributedString(string: "添加语音签名获得优先推荐")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
           attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
           
           let attrString1 = NSMutableAttributedString(string: "添加语音签名享有优先推荐和曝光，收\n到打招呼的几率增加10倍！")
        
           let paragh = NSMutableParagraphStyle()
           paragh.alignment = .center
           paragh.lineSpacing = 3
           
           let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
           
           attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
           
           
           let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "voice_group_become_broadcaster", confirmText: "去添加", cancelText: "稍后再说")

        alert.confirm_btn.backgroundColor = UIColor.init(hex: 0xFEC207)
        
           alert.overCurrentContext = true
           
           alert.over_current_context_alpha = "0.4"

           alert.cover_image_size = CGSize.init(width: 202, height: 118)
        
           alert.root_view_height = 352
           
           alert.root_view_width = 300
        
           alert.widerButtonHeight = true
        
        
        alert.confirm_closure = {
            
            let editVC = ST_EditMyInfoViewController()
            
            ST_BTLaunchController.shared.navigationController?.pushViewController(editVC, animated: true)
        }
        
        GlobalPresent(toController: alert)
        
    }
    
    /**
     每次点击 伴心Tab 提示上传封面
     */
    static func createTipsForRoomCoverAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "完成封面上传获得优先配对")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
           attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
           
           let attrString1 = NSMutableAttributedString(string: "完成房间封面上传享有优先推荐和曝\n光，收到喜欢的几率增加5倍～")
        
           let paragh = NSMutableParagraphStyle()
           paragh.alignment = .center
           paragh.lineSpacing = 3
           
           let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
           
           attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
           
           
           let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "room_cover_tips", confirmText: "去上传", cancelText: "稍后再说")

        alert.confirm_btn.backgroundColor = UIColor.init(hex: 0xFEC207)
        
           alert.overCurrentContext = true
           
           alert.over_current_context_alpha = "0.4"

           alert.cover_image_size = CGSize.init(width: 202, height: 118)
        
           alert.root_view_height = 352
           
           alert.root_view_width = 300
        
           alert.widerButtonHeight = true
        
            return alert
        
    }
    
    
    
    /**
     匿名评论弹窗
     */
    class func createAnonymousCommentAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "开启匿名评论")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "开启后除了发布者本人，其他人不能\n访问你的个人主页，也不会看到你的\n昵称、头像、会员与认证标识")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "anonymous_alert_icon", confirmText: "确认开启", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 90, height: 90)
        
        alert.root_view_height = 337
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        
        return alert
        
    }
    
    
    /**
     道具喜欢 Alert
     */
    static func createReceivedPropAlert(model:ST_PairsLoveItemViewModel)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "他赠送了你\(model.props_name)")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let normalAttributes:[Attribute] = [.textColor(UIColor.init(hex: 0x61666F)!),.font(UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.regular))]
        
        let highlineAttributes:[Attribute] = [.textColor(UIColor.init(hex: 0xFEC207)!),.font(UIFont.systemFont(ofSize: 14, weight: UIFont.Weight.medium))]
        
        let attrString1 = "只有接受对方的喜欢才能获得价值\n".withAttributes(normalAttributes)
        
        attrString1.append(String(format: "%.2f\(Defaults[.PandaStr])", model.props_integral).withAttributes(highlineAttributes))
        
        attrString1.append("的\(model.props_name)哦~".withAttributes(normalAttributes))
        
        let p = NSParagraphStyle.create_line_spacing_paragraph_style(lineSpacing: 3)
        p.alignment = .center
        
        attrString1.addAttributes([Attribute.paragraphStyle(p)], range: NSRange.init(location: 0, length: attrString1.length))
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageURL: model.props_image, confirmText: "接受喜欢", cancelText: "仍要拒绝")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 120, height: 120)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    /**
     认证之后ti现
     */
    static func createDetectFaceForIncomeAlert()->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "通过真人认证才能\(Defaults[.PandaTiStr])")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: "完成了真人头像认证后就可以进行\(Defaults[.PandaTiStr])\n申请了哦！")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "立即认证", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     Unlock Wechat
     */
    static func createUnlockWechatAlert(propName:String)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: "解锁她的微信号")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        
        let normalAttributes = [Attribute.font(Font.systemFont(ofSize: 14, weight: .regular)),Attribute.textColor(UIColor.init(hex: 0x61666F)!)]
        
        
        let highLineAttributes = [Attribute.font(Font.systemFont(ofSize: 14, weight: .regular)),Attribute.textColor(UIColor.init(hex: 0xFEC207)!)]
        
        let content = "亲密度达到".withAttributes(normalAttributes)
        
        let content0 = propName.withAttributes(highLineAttributes)
        
        let content1 = "即可自动解锁她的\n本人微信号并且".withAttributes(normalAttributes)
        
        let content2 = "开启畅聊".withAttributes(highLineAttributes)
        
        let content3 = "。聊天、送\n礼、守护、通话都可以增加亲密度".withAttributes(normalAttributes)
        
        content.append(content0)
        content.append(content1)
        content.append(content2)
        content.append(content3)
        
        content.addAttributes([NSAttributedString.Key.paragraphStyle : NSParagraphStyle.create_line_spacing_paragraph_style(lineSpacing: 2)], range: NSRange(location: 0, length: content.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: content, imageName: "wechatUnlockIcon", confirmText: "立刻提升亲密度", cancelText: "继续聊天")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 372
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    static func createSettingWechatAlert()->BTVerticalAlertViewController{
        
        let json = SCComponets.rich_text_storage_component.json["engagement_chat"]
        
        let attrString = NSMutableAttributedString(string: json["title"].stringValue)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        
        let normalAttributes = [Attribute.font(Font.systemFont(ofSize: 14, weight: .regular)),Attribute.textColor(UIColor.init(hex: 0x61666F)!)]
        
        
        let highLineAttributes = [Attribute.font(Font.systemFont(ofSize: 14, weight: .regular)),Attribute.textColor(UIColor.init(hex: 0xFEC207)!)]
        
        let content = json["content"][0].stringValue.withAttributes(normalAttributes)
        
        let content0 = json["content"][1].stringValue.withAttributes(highLineAttributes)
        
        let content1 = json["content"][2].stringValue.withAttributes(normalAttributes)
        
        let content2 = json["content"][3].stringValue.withAttributes(highLineAttributes)
        
        let content3 = json["content"][4].stringValue.withAttributes(normalAttributes)
        
        content.append(content0)
        content.append(content1)
        content.append(content2)
        content.append(content3)
        
        let p = NSParagraphStyle.create_line_spacing_paragraph_style(lineSpacing: 2)
        p.alignment = .center
        
        content.addAttributes([NSAttributedString.Key.paragraphStyle : p], range: NSRange(location: 0, length: content.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: content, imageName: json["icon"].stringValue, confirmText: "立刻填写", cancelText: "稍后")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 372
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    /**
     关闭配对Alert
     */
    static func stopMatchingAlert()->BTVerticalAlertViewController{
        
       
        let json = SCComponets.rich_text_storage_component.json["stopMatchingAlert"]
        
        let attrString = NSMutableAttributedString(string: json["title"].stringValue)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        
        let attrString1 = NSMutableAttributedString(string: json["content"].stringValue)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "继续等待", cancelText:  json["cancelStr"].stringValue)
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    /**
     绑定手机号
     return true 需要绑定手机号跳过
     */
    static func toastBindPhoneRequireAlert(fromController:UIViewController?)->Bool{
        
        
        if ST_BTUserInfoManager.shared.confined_to_ticket(){
                
            let vc = ST_TicketViewController()
            
            vc.from = .mainIndexConfined
            
            GlobalPresent(toController: vc)
            
            return true
        }
        
        if let check = ST_BTUserInfoManager.shared.additional_attributes?.phoneBound{
            
            if !check {
                
                let title = "必须绑定手机才能使用"
                
                let content = "国家政策规定用户必须绑定手机才能使\n用互动相关功能～请先绑定手机哦！"
                
                let alert = BTVerticalAlertViewController.createDetectFaceForTalkAlert(title: title, content: content, confirmStr: "立即绑定", cancelStr: "稍后再说")
                
                alert.confirm_closure = {
                    
                    MobClick.event("BindPhoneNumber_PopWindow", attributes: ["Button_name":"立即绑定"])
                    
                    ST_MobilePhoneStepDispatcher.shared.start_phone_number(state: MobilePhoneNumberViewStep.bind, controller: fromController)
                    
                }
                
                alert.cancel_closure = {
                    
                    MobClick.event("BindPhoneNumber_PopWindow", attributes: ["Button_name":"稍后再说"])
                }
                
                GlobalPresent(toController: alert)
                
                MobClick.event("PopWindow_Pageview", attributes: ["Page_name":"绑定手机弹窗"])
                return true
                
            }else{
                
                return false
            }
            
        }else{
            
            fromController?.toast(text: "当前网络环境不太稳定，请稍等片刻~")
            
            return true
        }
    }
    
    
    
    static func createDirectedRecommendTalkAlert(title:String,content:String,confirmStr:String,cancelStr:String)->BTVerticalAlertViewController{
        
        let attrString = NSMutableAttributedString(string: title)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
        
        let attrString1 = NSMutableAttributedString(string: content)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: confirmStr, cancelText: cancelStr)
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
        
    }
    
    
    /**
     充值同SE  Alert x
     */
    static func createChatRequireRechargeAlert()->BTVerticalAlertViewController{
        
        
        let json = SCComponets.rich_text_storage_component.json["confine_private"]
        
        let attrString = NSMutableAttributedString(string: json["title"].stringValue)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: json["content"].stringValue)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "kValue不够了", confirmText: "立即开启", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    
    
    
    /**
     设置私密派对
     */
    static func createSettingPrivateAlert()->BTVerticalAlertViewController{
        
        
        let attrString = NSMutableAttributedString(string: "设为私密派对")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: "派对设为私密后，派对成员只能通过邀\n请加入")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "voice_group_private", confirmText: "设为私密", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        return alert
        
    }
    
    /**
     冻结的Alert
     */
    static func presentFreezeAlert(time:String){
        
        
        let attrString = NSMutableAttributedString(string: "限制功能使用")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: "用户您好，因为您的账号在近期收到了\n严重投诉，该账号部分功能被限制\n使用。解冻期为：\(time)")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "我知道了", cancelText: "")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        GlobalPresent(toController: alert)
        
    }
    
    
    /**
     关闭派对
     */
    static func presentCloseRoomAlert()->BTVerticalAlertViewController{
        
        
        let attrString = NSMutableAttributedString(string: "关闭派对？")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: "关闭派对后，所有成员都会被请出房\n间，确认要关闭吗？")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "voice_group_private", confirmText: "再聊聊吧", cancelText: "关闭派对")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        GlobalPresent(toController: alert)
        
        
        return alert
        
    }
    
    
    
    
    /**
     成为主播
     */
    static func presentBecomeBroadcasterAlert()->BTVerticalAlertViewController{
        
        let json = SCComponets.rich_text_storage_component.json["become_broadcaster"]
        
        let attrString = NSMutableAttributedString(string: json["title"].stringValue)
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: json["content"].stringValue)
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "voice_group_become_broadcaster", confirmText: "开麦聊天", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        
        GlobalPresent(toController: alert)
        
        
        return alert
        
    }
    
    
    
    
    /**
     清空聊天列表
     */
    static func clearAllRecentSessionsAlert()->BTVerticalAlertViewController{
        
        
        
        let attrString = NSMutableAttributedString(string: "清空聊天列表！")
        
        let attr: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 18, weight: UIFont.Weight.medium),.foregroundColor: UIColor.init(hex: 0x333333)!]
        
        attrString.addAttributes(attr, range: NSRange(location: 0, length: attrString.length))
         
        
        let attrString1 = NSMutableAttributedString(string: "清空聊天列表也不会丢失聊天记录\n如有需要请放心清空")
        
        let paragh = NSMutableParagraphStyle()
        paragh.alignment = .center
        paragh.lineSpacing = 3
        
        let attr1: [NSAttributedString.Key : Any] = [.font: UIFont.systemFont(ofSize: 14),.foregroundColor: UIColor(red: 0.4, green: 0.4, blue: 0.4, alpha: 1),.paragraphStyle:paragh]
        
        attrString1.addAttributes(attr1, range: NSRange(location: 0, length: attrString1.length))
        
        
        let alert = BTVerticalAlertViewController.init(title: attrString, message: attrString1, imageName: "vertical_icon_提示", confirmText: "全部清空", cancelText: "稍后再说")
        
        alert.overCurrentContext = true
        
        alert.over_current_context_alpha = "0.4"
        
        alert.cover_image_size = CGSize.init(width: 202, height: 119)
        
        alert.root_view_height = 352
        
        alert.root_view_width = 300
        
        alert.widerButtonHeight = true
        
        
        GlobalPresent(toController: alert)
        
        
        return alert
        
    }
}
